package com.lsy.weizhi2.myutils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.webkit.JavascriptInterface;

import com.lsy.share_qq_weixin_weibo.Share;
import com.lsy.weizhi2.config.MyInfo;
import com.lsy.weizhi2.utils.MyMethod;


/**
 * Created by 嗨哟 on 2017/3/25.
 */
public class LingQu {
    Context context;
    final String QQ1="100";
    final String QQ2="200";
    final String WEIXIN1="300";
    final String WEIXIN2="400";
    final String WEIBO1="500";

    public LingQu(Context context) {
        this.context=context;

    }

    @JavascriptInterface
    public boolean lingQu(){

        return true;
    }
    @JavascriptInterface
    public void getMoney(String phone,String code,String password,String friend){

    }

    @JavascriptInterface
    public void onLoad(final String sign){
        ((Activity)context).runOnUiThread(new Runnable() {
            @Override
            public void run() {
                Log.i("LingQu","onLoad");
                Log.i("LingQu","sign==111=="+sign);
                switch (sign){
                    case QQ1:
                        MyMethod.toActivity(context,Share.class,new String[]{"sign","name","id","phone"},new String[]{"100", MyInfo.Name,MyInfo.User_Id+"",MyInfo.Phone});
                        break;
                    case QQ2:
                        MyMethod.toActivity(context,Share.class,new String[]{"sign","name","id","phone"},new String[]{"200", MyInfo.Name,MyInfo.User_Id+"",MyInfo.Phone});
                        break;
                    case WEIXIN1:
                        MyMethod.toActivity(context,Share.class,new String[]{"sign","name","id","phone"},new String[]{"300", MyInfo.Name,MyInfo.User_Id+"",MyInfo.Phone});
                        break;
                    case WEIXIN2:
                        MyMethod.toActivity(context,Share.class,new String[]{"sign","name","id","phone"},new String[]{"400", MyInfo.Name,MyInfo.User_Id+"",MyInfo.Phone});
                        break;
                    case WEIBO1:
                        MyMethod.toActivity(context,Share.class,new String[]{"sign","name","id","phone"},new String[]{"500", MyInfo.Name,MyInfo.User_Id+"",MyInfo.Phone});
                        break;
                }

            }
        });

    }
}
